Skip to content

Conversation

aleskxyz
Copy link

@aleskxyz aleskxyz commented Aug 1, 2025

SUMMARY

Add comprehensive network interface management capabilities to the Proxmox collection with two new modules: proxmox_node_network for managing network interfaces and proxmox_node_network_info for retrieving network interface information. These modules support all major Proxmox network interface types including bridges, bonds, VLANs, and Open vSwitch interfaces with staged configuration management to prevent accidental network disruption.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

proxmox_node_network, proxmox_node_network_info

ADDITIONAL INFORMATION

New Modules Added:

  • proxmox_node_network: Manage network interfaces (bridge, bond, eth, vlan, OVS)
  • proxmox_node_network_info: Retrieve network interface information

Key Features:

  • Staged configuration management with apply/revert functionality
  • Support for all major interface types (bridge, bond, eth, vlan, OVSBridge, OVSBond, OVSIntPort)
  • Comprehensive parameter validation for each interface type
  • Support for parameter deletion (string params with empty string, integer params with -1)
  • Full check mode support
  • Full diff mode support

@aleskxyz aleskxyz changed the title Add proxmox_node_network and proxmox_node_network_info modules Feature: add proxmox_node_network and proxmox_node_network_info modules Aug 1, 2025
@aleskxyz aleskxyz marked this pull request as draft August 1, 2025 15:27
Copy link

codecov bot commented Aug 2, 2025

Codecov Report

❌ Patch coverage is 86.56716% with 180 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.19%. Comparing base (d2f0ec5) to head (162921a).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
plugins/modules/proxmox_node_network.py 69.70% 117 Missing and 56 partials ⚠️
plugins/modules/proxmox_node_network_info.py 91.42% 6 Missing ⚠️
.../unit/plugins/modules/test_proxmox_node_network.py 99.82% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #153      +/-   ##
==========================================
+ Coverage   64.42%   68.19%   +3.76%     
==========================================
  Files          64       68       +4     
  Lines        6530     7870    +1340     
  Branches     1257     1639     +382     
==========================================
+ Hits         4207     5367    +1160     
- Misses       2147     2271     +124     
- Partials      176      232      +56     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aleskxyz aleskxyz force-pushed the add-network-module branch from e566edd to 5260015 Compare August 3, 2025 19:07
@aleskxyz aleskxyz marked this pull request as ready for review August 3, 2025 19:09
@Thulium-Drake
Copy link
Collaborator

@gyptazy Would you have time to review this? I'm not well-versed enough in Python to review this :-(

@gyptazy
Copy link
Contributor

gyptazy commented Aug 16, 2025

@gyptazy Would you have time to review this? I'm not well-versed enough in Python to review this :-(

Will do but can't promise to do it this weekend. Probably on Monday.

"""Validate IPv4 CIDR format."""
if not cidr:
return False
pattern = r"^(\d{1,3}\.){3}\d{1,3}/\d{1,2}$"
Copy link
Contributor

@gyptazy gyptazy Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kudos for validating! But in that case we should probably to a more strict validating like:

_cidr_re = re.compile(
    r'^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
    r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
    r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
    r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)'
    r'/(3[0-2]|[12]?\d)$'
)

Maybe this is the point, where we should simply use libs like ipaddress instead of reinventing the wheel.

"""Validate IPv6 CIDR format."""
if not cidr:
return False
pattern = r"^[0-9a-fA-F:]+/\d{1,3}$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might not be strict enough. Maybe this fits better:

r'^([0-9A-Fa-f:]+::?[0-9A-Fa-f:]*)/(12[0-8]|1[01][0-9]|[0-9]{1,2})$'

Also here, maybe better to use an external lib like ipaddress; even I'd like to avoid it.

Copy link
Contributor

@IamLunchbox IamLunchbox Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And since ipaddress is part of the standard library, using it would outsource complexity and not include major (installation) overhead. :)

Out of curiosity: Why would you like avoid including this library otherwise?

@gyptazy
Copy link
Contributor

gyptazy commented Aug 19, 2025

Hey @aleskxyz,

that's well written and structured - appreciate your work! There're just some smaller things that're not yet important (but might need some changes in future releases) but it doesn't make sense or brings any huge benefits to adjust this right now. I didn't give OVS a try but apart from that it looks good to me. Just the regex might fail. I mean, it would be a user error but when we already have a validate function, we should do a proper validation (I added a quick idea, could probably also be improved).

So far, well done!

cc: @Thulium-Drake

Cheers,
gyptazy

- proxmox_node_network: Manage network interfaces (bridge, bond, eth, vlan, OVS)
- proxmox_node_network_info: Retrieve network interface information
- Support for staged configuration changes with apply/revert functionality
- Full validation for interface-specific parameters
- Comprehensive test coverage
- Update runtime.yml to include new modules in proxmox action group
- Support for parameter deletion
@aleskxyz
Copy link
Author

Hey @aleskxyz,

that's well written and structured - appreciate your work! There're just some smaller things that're not yet important (but might need some changes in future releases) but it doesn't make sense or brings any huge benefits to adjust this right now. I didn't give OVS a try but apart from that it looks good to me. Just the regex might fail. I mean, it would be a user error but when we already have a validate function, we should do a proper validation (I added a quick idea, could probably also be improved).

So far, well done!

cc: @Thulium-Drake

Cheers, gyptazy

Hi @gyptazy
I have updated the code and refactored the logic with the help of the ipaddress module. I have also mentioned it as a requirement in the document section.
The feature branch has been rebased onto the latest commit on the main branch.
Thanks.

@Thulium-Drake
Copy link
Collaborator

@aleskxyz Thanks for your work!

@gyptazy @IamLunchbox Are you happy with the results? :-)

@gyptazy
Copy link
Contributor

gyptazy commented Oct 4, 2025

@aleskxyz Thanks for your work!

Also from me, thanks again for your work and sorry for the delay!

@gyptazy @IamLunchbox Are you happy with the results? :-)

I’m currently abroad and will have a look at it asap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants